package com.fk.dao.impl;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;



import com.fk.entity.Company;
import com.fk.util.DBManager;

public class CompanyDaoImpl {
	public Company getCompany() {
		Connection conn = DBManager.getConnection();
		Statement st = null;
		ResultSet rs = null;
		Company company = null;
		try {
			st = conn.createStatement();
			String sql = "select * from company";
			rs = st.executeQuery(sql);
			while(rs.next()) {
				String name = rs.getString("name");
				String website = rs.getString("website");
				String introduction = rs.getString("introduction");
				String phone = rs.getString("phone");
				String email = rs.getString("email");
				String address = rs.getString("address");
				String culture = rs.getString("culture");
				String logo = rs.getString("logo");
				company = new Company(name, website, introduction, phone, email, address, culture, logo);
			}
			return company;
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}finally {
			DBManager.closeAll(conn, st, rs);
		}
		
	}
}
